<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .wrap {
            border: 1px solid;
            /* overflow: hidden; */
        }
        .child {
            width: 100px;
            height: 100px;
            background: yellow;
            float: left;
        }
        .clean-float {
            clear: both;
            height: 0;
            overflow: hidden;
        }
        .wrap-sec {
            display: inline-block;
            border: 1px solid;
        }
        .child-sec {
            width: 100px;
            height: 100px;
            background: yellow;
            float: left;
        }
        .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
        .clearfix{zoom:1; border: 1px solid;}
        .parent{width:120px;}
        .left{float:left;display:inline;}
        .right{float:right;display:inline;}
    </style>
</head>
<body>
    <div class="wrap">
        <div class="child">
            111
        </div>
        <div class="clean-float">
        <!-- 加入一个空的div并且，给clear: both 就可以进行消除浮动 -->
        </div>
    </div>

    <div class="wrap-sec">
        <div class="child-sec">
            2222
        </div>
    </div>

    <div class="clearfix">
        <div class="left">
            left
        </div>
        <div class="right">
            right
        </div>
    </div>

    <div class="clearfix">
            <div class="left">
                 left
               </div>
               <div class="right">
                 right
               </div>
           </div>
</body>
</html>